package utils;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import org.jetbrains.annotations.NotNull;

public class WorksListAdapter extends FragmentPagerAdapter {

    private Fragment[] fragments;
    private String[] titles;

    public WorksListAdapter(FragmentManager fragmentManager, Fragment[] fragments, String[] titles) {
        super(fragmentManager);
        this.titles = titles;
        this.fragments = fragments;
    }

    @NonNull
    @NotNull
    @Override
    public Fragment getItem(int position) {
        return fragments[position];
    }

    @Override
    public int getCount() {
        return titles.length;
    }

    @Nullable
    @org.jetbrains.annotations.Nullable
    @Override
    public CharSequence getPageTitle(int position) {

        return titles[position];
    }
}
